﻿/* Write a program that extracts from given HTML file its title (if available), and its body text without the HTML tags. Example:
<html>
<head><title>News</title</head>
<body><p><a href = "http://academy.telerik.com">Telerik Academy</a>aims to provide free real-world practical
trainning for young people who want to turn into skillfull .NET software engineers.</p></body>
</html> */

using System;
using System.Text.RegularExpressions;

namespace _25.ExtractHTMLBodyAndTitle
{
    class ExtractHTMLBodyAndTitle
    {
        static void Main()
        {
            string str = @"<html>
                        <head><title>News</title</head>
                        <body><p><a href = ""http://academy.telerik.com"">Telerik Academy</a>aims to provide free real-world practical
                        trainning for young people who want to turn into skillfull .NET software engineers.</p></body>
                        </html>";
            Regex r = new Regex(@"(?<=>).*?(?=<)", RegexOptions.Compiled);
            foreach (Match text in r.Matches(str)) if (!String.IsNullOrWhiteSpace(text.Value)) Console.WriteLine(text);
        }
    }
}
